<?

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#	FILE:			includes/custom/admingroups.php
#	FUNCTION:		Custom handler for the Admin Groups page
#	AUTHOR:			Cameron Morrow
#	CREATED:		27/07/2005
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# D A T A   F O R   G R O U P S
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Table
$current_table = $PROJECT_DB_TABLES["groups"];

# Field to sort browse on
$browse_sort_field = "g_name";

# Field to group browse on
$browse_group_field = "";

# Is index numeric
$index_numeric = true;

# Index field
$index_field = "g_id";

# Type name
$type_name = "Group";

# Plural
$type_name_plural = "Groups";

# Custom Columns
$custom_columns = array();

# Add custom column for editing users in this group
$custom_columns[] =array("Users", "\"<a href=\\\"javascript:editGroupUsers('[g_id]');\\\">Edit Users</a>\"");

# Actions
$custom_columns[] = generateAddEditColumn($index_field);

# Browse SQL
$browse_sql_additional_where_clauses = array();

# Limit to groups this user level can access
$group_limits = "";
foreach ($USER -> getEditableGroups() as $group_counter => $editable_group) {
	 $group_limits .= "g_id = " . $editable_group;
	 if ($group_counter < count($USER -> getEditableGroups()) - 1) {
		 $group_limits .= " OR ";
	 }
}
$browse_sql_additional_where_clauses[] = "(" . $group_limits . ")";


$browse_sql_search_fields = array("g_name");

# Edit SQL
$edit_sql_additional_selects = array();
$edit_sql_additional_tables = array();
$edit_sql_additional_where_clauses = array();

include("../includes/custom/adminhandler.php");
?>